import {
  req,
  json
} from './axiosFun';


// 场景列表
export const SceneList = (params) => {
  return req("post", "/rule_engine/scenes", params)
};

// 场景保存
export const SceneSave = (params) => {
  return json("post", "/rule_engine/saveScene", params)
};

// 场景删除
export const SceneDelete = (sceneId) => {
  return req("delete", "/rule_engine/scene/"+sceneId+'/delete', {})
};

// 暂停场景
export const ScenePause = (sceneId) => {
  return req("post", "/rule_engine/scene/"+sceneId+"/pause",{})
};

// 恢复场景
export const SceneResume = (sceneId) => {
  return req("post", "/rule_engine/scene/"+sceneId+"/resume",{})
};

// 场景日志
export const SceneLogsList = (params) => {
  return req("post", "/rule_engine/scene/"+params.sceneId+"/logs/"+params.size+"/"+params.page, {})
};

export const SceneLogsClear = (sceneId) => {
  return req("delete", "/rule_engine/scene/"+sceneId+"/logs/clear", {})
};


// 任务列表
export const TaskList = (params) => {
  return req("post", "/rule_engine/tasks", params)
};

// 任务保存
export const TaskSave = (params) => {
  return json("post", "/rule_engine/saveTask", params)
};

// 停止任务
export const TaskPause = (taskId) => {
  return req("post", "/rule_engine/task/"+taskId+"/pause",{})
};

// 恢复任务
export const TaskResume = (taskId) => {
  return req("post", "/rule_engine/task/"+taskId+"/resume",{})
};

// 重启开始任务
export const TaskRenew = (taskId) => {
  return req("post", "/rule_engine/task/"+taskId+"/renew",{})
};

// 删除任务
export const TaskDelete = (taskId) => {
  return req("delete", "/rule_engine/task/"+taskId+"/delete",{})
};


// 任务日志
export const TaskLogsList = (params) => {
  return req("post", "/rule_engine/task/"+params.taskId+"/logs/"+params.size+"/"+params.page, {})
};

export const TaskLogsClear = (taskId) => {
  return req("delete", "/rule_engine/task/"+taskId+"/logs/clear", {})
};
